package com.whiteblue.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * Created by WhiteBlue on 15/4/5.
 */
public class RegisterValidator extends Validator {
    @Override
    protected void validate(Controller controller) {
        this.validateString("email", true, 4, 30, "msg", "email地址有误");
        this.validateEmail("email", "msg", "email地址有误");
        this.validateString("password", true, 4, 30, "msg", "密码有误");
        this.validateString("name", true, 1, 20, "msg", "昵称有误");
    }

    @Override
    protected void handleError(Controller controller) {
        controller.render("/info.html");
    }
}
